package com.wondream.myframework.app.common.exception;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.Getter;

/**
 * 业务异常编码
 */
@Getter
@AllArgsConstructor
public enum BusinessExeceptionCode {

    SYS_ERROR("1000100001", "系统异常"),
    ;

    private String code;
    private String msg;

    public BusinessException exp(Throwable e) {
        return new BusinessException(code, msg, e);
    }

    public BusinessException exp(Object... args) {
        String errorMsg = String.format(msg, args);
        return new BusinessException(code, errorMsg);
    }

    public BusinessException error(String errorMsg) {
        return new BusinessException(code, errorMsg);
    }

    public BusinessException exp() {
        return new BusinessException(code, msg);
    }

}
